<template>
	<view :style="theme">
		<view style="height: 30rpx;"></view>
		<YdList :list="list" />
		<u-loadmore v-if="end && list.length >= 10" :status="status" line />
		<view v-if="list.length === 0" class="no-order">
			<image :src="imgHost+'/default_nodata.png'"></image>
			<view>暂无数据～</view>
		</view>
	</view>
</template>

<script>
	import YdList from "@/components/ydList.vue";
	export default {
		components: {
			YdList
		},
		data() {
			return {
				list: [],
				page: 1,
				end: false,
				firstQueryTime: '',
				status: 'nomore',
			}
		},
		onShow() {
			this.searchBtn()
		},
		methods: {
			jump(url, params, a) {
				this.$app.jump(url, params, a);
			},
			jump2(url, params, a) {
				this.$app.jump2(url, params, a);
			},
			searchBtn() {
				this.firstQueryTime = this.$app.firstQueryTime()
				this.list = [];
				this.page = 1;
				this.end = false;
				this.getList()
			},
			getList() {
				this.$app.ajax({
					data: {
						pagination: {
							firstQueryTime: this.firstQueryTime,
							page: this.page,
							rows: 10
						},
						param: {
							venueId: this.venueId,
							type: '1'
						}
					},
					api: this.$api.listWXKnowledge()
				}).then((res) => {
					if (res.errorCode === '000000') {
						if (!res.recordList || res.recordList.length < 10) {
							this.end = true
						}
						if (res.recordList) {
							this.list = this.list.concat(res.recordList)
						}
					}
				}).catch(() => {})
			},
			reachBottom() {
				if (!this.end) {
					this.page += 1;
					this.getList();
				}
			},
			// 触底加载更多数据
			onReachBottom(e) {
				this.reachBottom()
			}

		}

	}
</script>
<!-- <style>
	page {
		background: #fff;
	}
</style> -->